amazon programming interview problem